-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PC-34454)[API] feat: add publicationDate to Algolia serializer #16241
Conversation
3132f25
to
41323a8
Compare
9b3870e
to
1caae26
Compare
@@ -573,6 +573,9 @@ def serialize_offer(cls, offer: offers_models.Offer, last_30_days_bookings: int) | |||
"name": offer.name, | |||
"nativeCategoryId": offer.subcategory.native_category_id, | |||
"prices": sorted(prices), | |||
"publicationDate": ( | |||
offer.publicationDate.isoformat() if offer.publicationDate and not offer.isReleased else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jusqu'ici on envoie (quasiment il me semble) toutes les dates au front sous forme de timestamp (les champs dates
, times
, isHeadlineUntil
, releaseDate
), on est ok sur le fait de gérer un nouveau format ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas de soucis pour changer, j'avais pris le même format que la date d'indexation mais je vais passer ça en timestamp :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, c'est vrai que c'est la seule incohérence, bien vu. C'est pas expliqué mais indexedAt
a été introduit uniquement pour du debug, d'où un format lisible par les humains, my bad.
offers_factories.FutureOfferFactory(offerId=offer_2.id, publicationDate=publication_date) | ||
|
||
serialized = algolia.AlgoliaBackend().serialize_offer(offer_1, 0) | ||
assert serialized["offer"]["publicationDate"] == publication_date.isoformat() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(vraiment détail) Par rapport à l'autre comm, je trouve ça cool ici si on écrit en dur la date qu'on attend pour que le format soit explicite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il me faut tout de même une date dans le futur, que je ne connais pas à priori hormis si je gèle le temps. Je me dis que c'est un peu overkill non ?
1caae26
to
9be39cc
Compare
But de la pull request
Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-34454
Vérifications